﻿package mortal.game.view.lotteryDraw
{
    import com.mui.controls.*;
    import extend.language.*;
    import flash.events.*;
    import mortal.common.*;
    import mortal.component.gconst.*;
    import mortal.component.window.*;
    import mortal.game.manager.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;

    public class LotteryDrawActiveTipWindow extends Window
    {
        private var _mainBg:GImageBitmap;
        private var _okBtn:GLoadingButton;
        private var _checkBox:GCheckBox;
        private static var _instance:LotteryDrawActiveTipWindow;

        public function LotteryDrawActiveTipWindow()
        {
            if (_instance != null)
            {
                throw new Error("LotteryDrawActiveTipWindow 单例 ");
            }
            this.layer = LayerManager.topLayer;
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            var _loc_1:int = 718;
            var _loc_2:int = 372;
            this.setSize(_loc_1, _loc_2);
            this._mainBg = UIFactory.gImageBitmap(ImagesConst.LotteryDrawActiveBg, 0, 0, this);
            this._okBtn = UIFactory.gLoadingButton(ResFileConst.LotteryDrawActiveOkBtn, (_loc_1 - 125) / 2, 275, 125, 44, this);
            this._okBtn.configEventListener(MouseEvent.CLICK, this.onOkClickHandler);
            this._checkBox = UIFactory.checkBox(Language.getString(21017), (_loc_1 - 95) / 2, 320, 200, 28, this);
            this._checkBox.drawNow();
            this._checkBox.configEventListener(Event.CHANGE, this.onCheckBoxChangeHander);
            this.pushUIToDisposeVec(this._mainBg);
            this.pushUIToDisposeVec(this._okBtn);
            this.pushUIToDisposeVec(this._checkBox);
            return;
        }// end function

        override protected function updateBtnSize() : void
        {
            super.updateBtnSize();
            if (_closeBtn != null)
            {
                _closeBtn.y = 60;
            }
            return;
        }// end function

        private function onOkClickHandler(event:MouseEvent) : void
        {
            hide();
            return;
        }// end function

        private function onCheckBoxChangeHander(event:Event) : void
        {
            PulseSharedObject.save(TodayNoTipsConst.LotteryDrawActiveTip, this._checkBox.selected);
            return;
        }// end function

        public static function get instance() : LotteryDrawActiveTipWindow
        {
            if (_instance == null)
            {
                _instance = new LotteryDrawActiveTipWindow;
            }
            return _instance;
        }// end function

    }
}
